﻿<navigation:Page 
	xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" 
	xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit" 
	xmlns:dataprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data" 
	x:Class="SystemScanningGui.CompareTwoComputers" 
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
	xmlns:tk="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" 
	mc:Ignorable="d" 
	d:DesignWidth="640" 
	d:DesignHeight="480" 
	Style="{StaticResource PageStyle}">
    <navigation:Page.Resources>
        <BitmapImage x:Key="LeftArrow" UriSource="../Assets/LeftArrow.png" />
        <BitmapImage x:Key="RightArrow" UriSource="../Assets/RightArrow.png" />
    </navigation:Page.Resources>
    <Grid x:Name="LayoutRoot">
        <toolkit:DockPanel >
            <StackPanel x:Name="ContentStackPanel" toolkit:DockPanel.Dock="Top">
                <Grid>
                    <Grid.Resources>
                        <Style TargetType="ComboBox" >
                            <Setter Property="MinWidth" Value="150" />
                        </Style>
                        <Style TargetType="tk:AutoCompleteBox" >
                            <Setter Property="MinWidth" Value="200" />
                        </Style>
                    </Grid.Resources>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" MinWidth="200"/>
                        <ColumnDefinition Width="*" MinWidth="200"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <StackPanel  Margin="5,0,5,0">
                        <tk:AutoCompleteBox 
								IsTextCompletionEnabled="True" 
								FilterMode="Contains" 
								ValueMemberPath="Hostname" 
								SelectedItem="{Binding ComputerSelectionLeft, Mode=TwoWay}" 
								Name="leftComputer" 
								MinimumPopulateDelay="300" 
								MinimumPrefixLength="2" 
								ItemsSource="{Binding ComputersLeft}">
                            <tk:AutoCompleteBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Hostname}" />
                                </DataTemplate>
                            </tk:AutoCompleteBox.ItemTemplate>
                        </tk:AutoCompleteBox>
                        <ComboBox 
								Name="leftScan" 
								SelectedItem="{Binding ScanSelectionLeft, Mode=TwoWay}"
								ItemsSource="{Binding LeftScans}">
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock   >
											<Run Text="{Binding Performed, StringFormat=yyyy-MM-dd HH:mm}" />
											<Run> { </Run>
											<Run Text="{Binding ScanID}" />
											<Run> }</Run>
                                    </TextBlock>
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>
                    </StackPanel>
                    <StackPanel  Margin="5,0,5,0" Grid.Column="1">
                        <tk:AutoCompleteBox 
								IsTextCompletionEnabled="True" 
								FilterMode="Contains" 
								ValueMemberPath="Hostname" 
								SelectedItem="{Binding ComputerSelectionRight, Mode=TwoWay}" 
								Name="rightComputer" 
								MinimumPopulateDelay="300" 
								MinimumPrefixLength="2" 
								ItemsSource="{Binding ComputersRight}">
                            <tk:AutoCompleteBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Hostname}" />
                                </DataTemplate>
                            </tk:AutoCompleteBox.ItemTemplate>
                        </tk:AutoCompleteBox>
                        <ComboBox 
								Name="rightScan" 
								SelectedItem="{Binding ScanSelectionRight, Mode=TwoWay}" 
								ItemsSource="{Binding RightScans}">
                            <ComboBox.ItemTemplate>
                                <DataTemplate>
                                    <TextBlock   >
											<Run Text="{Binding Performed, StringFormat=yyyy-MM-dd HH:mm}" />
											<Run> { </Run>
											<Run Text="{Binding ScanID}" />
											<Run> }</Run>
                                    </TextBlock>
                                </DataTemplate>
                            </ComboBox.ItemTemplate>
                        </ComboBox>

                    </StackPanel>
                    <StackPanel Grid.Column="2">
                        <Button Command="{Binding LoadComparisonCommand}">Load Comparison</Button>
                    </StackPanel>
                </Grid>


            </StackPanel>
            <Grid 
				toolkit:DockPanel.Dock="Top" 
				Margin="3,10,3,10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0" Orientation="Horizontal">
                    <TextBlock  Text="{Binding ScanComparison.LeftHeader}" Margin="5,3,5,3" />
                    <Image Source="{StaticResource LeftArrow}" Width="24" Height="24" Margin="5,3,5,3" />
                </StackPanel>
                <StackPanel Grid.Column="1" Orientation="Horizontal">
                    <Image Source="{StaticResource RightArrow}" Width="24" Height="24" Margin="5,3,5,3" />
                    <TextBlock  Text="{Binding ScanComparison.RightHeader}" Margin="5,3,5,3" />
                </StackPanel>
            </Grid>
            <sdk:DataGrid
				IsReadOnly="True" 
				AutoGenerateColumns="False"
				Margin="5,3,5,3"
				ItemsSource="{Binding ScanComparison.Differences}">
                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Width="Auto" Binding="{Binding FromWhere}" Header="Computer" />
                    <sdk:DataGridTemplateColumn Width="Auto" Header="Type" SortMemberPath="Type">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" Margin="5,0,5,0">
                                    <Image Height="24" Width="24" Margin="3,0,3,0" Source="{Binding Icon}"/>
                                    <TextBlock Text="{Binding Type}" VerticalAlignment="Center"/>
                                </StackPanel>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTextColumn Width="*" Binding="{Binding Description}" Header="Description" />
                    <sdk:DataGridTemplateColumn Width="Auto" Header="On Left?" SortMemberPath="ExistsOnLeft">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Image HorizontalAlignment="Center"
									Source="{StaticResource LeftArrow}" 
									Visibility="{Binding LeftVisibility}" 
									Width="24" 
									Height="24"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                    <sdk:DataGridTemplateColumn Width="Auto" Header="On Right?" SortMemberPath="ExistsOnRight">
                        <sdk:DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Image HorizontalAlignment="Center"
									Source="{StaticResource RightArrow}" 
									Visibility="{Binding RightVisibility}" 
									Width="24" 
									Height="24"/>
                            </DataTemplate>
                        </sdk:DataGridTemplateColumn.CellTemplate>
                    </sdk:DataGridTemplateColumn>
                </sdk:DataGrid.Columns>

            </sdk:DataGrid>
        </toolkit:DockPanel>
    </Grid>

</navigation:Page>